Determine top-level project for module nested in sub-project

We have a number of projects where sub-projects were used instead of folders, and I'm looking for a way to determine the top-most project using DXL. I'm going to be using that value to modify some attributes within the module. I've tried using getParentProject but I can't figure out how to go further up the project chain. I know it has to be something simple. Any help would be appreciated.
SystemAdmin - Mon Nov 26 15:43:53 EST 2012

Re: Determine top-level project for module nested in sub-project
Mathias Mamsch - Mon Nov 26 17:55:13 EST 2012

Why not apply getParentProject recursively, e.g.:
 

Project getRootProject (Item I) {
    Project p = getParentProject I 
    
    while (!null p && !null getParentProject item fullName p) p = getParentProject item fullName p
    return p 
}

 


I did not try/check the code, but I guess this should give you the idea. Hope that helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Determine top-level project for module nested in sub-project
SystemAdmin - Tue Nov 27 14:33:06 EST 2012

Thanks, that's exactly what I was looking for. An extra kudo for the fast response.
BTW, these forums provide a great resource for folks like me. Thanks again!